import Taro, { Component } from '@tarojs/taro'
import { View, Image, Text } from '@tarojs/components'
import { AtTabBar } from 'taro-ui'
import { connect } from '@tarojs/redux'

import './index.scss'

const tabList = Taro.getApp().config.tabBar.list.map(item =>
    ({ pagePath: item.pagePath, text: item.name, image: item.iconPath, selectedImage: item.selectedIconPath }))



class TabBar extends Component {

    render() {
        return (
            <AtTabBar fixed tabList={tabList} current={this.props.currentPageIndex}>
            </AtTabBar>
        )
    }
}

const mapStateToProps = ({ tabPage }) => {
    return {
        currentPageIndex: tabPage.currentPageIndex
    };
};

const mapDispatchToProps = () => {
    return {
    };
}

export default connect(mapStateToProps, mapDispatchToProps)(TabBar)

